﻿namespace ZFramework.Runtime
{
    public delegate void LoadBinarySuccessCallback(string assetName, byte[] binaryBytes, float duration, object userData);

    public delegate void LoadBinaryFailureCallback(string assetName, string errorMessage, object userData);

    public class LoadBinaryCallbacks
    {
        private readonly LoadBinarySuccessCallback _loadBinarySuccessCallback;
        private readonly LoadBinaryFailureCallback _loadBinaryFailureCallback;

        public LoadBinaryCallbacks(LoadBinarySuccessCallback loadBinarySuccessCallback)
            : this(loadBinarySuccessCallback, null)
        {
        }

        public LoadBinaryCallbacks(LoadBinarySuccessCallback loadBinarySuccessCallback,
            LoadBinaryFailureCallback loadBinaryFailureCallback)
        {
            _loadBinarySuccessCallback = loadBinarySuccessCallback;
            _loadBinaryFailureCallback = loadBinaryFailureCallback;
        }

        public LoadBinarySuccessCallback LoadBinarySuccessCallback
        {
            get { return _loadBinarySuccessCallback; }
        }

        /// <summary>
        /// 获取加载资源失败回调函数。
        /// </summary>
        public LoadBinaryFailureCallback LoadBinaryFailureCallback
        {
            get { return _loadBinaryFailureCallback; }
        }
    }
}